package org.action;
import java.util.List;
import java.util.Map;

import org.model.Zyb;
import org.service.ZyService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class ZyAction extends ActionSupport {
	private int pageNow=1;
	private int pageSize=8;
	
	private Zyb zy;
	private ZyService zyService;


	public Zyb getZy() {
		return zy;
	}
	public void setZy(Zyb zy) {
		this.zy = zy;
	}
	public ZyService getZyService() {
		return zyService;
	}
	public void setZyService(ZyService zyService) {
		this.zyService = zyService;
	}

	
	public int getPageNow() {
		return pageNow;
	}
	public void setPageNow(int pageNow) {
		this.pageNow = pageNow;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	
	public String addZy()throws Exception{
		Zyb zy1=new Zyb();
		zy1.setZym(zy.getZym());
		zy1.setRs(zy.getRs());
		zy1.setFdy(zy.getFdy());
		Map request=(Map)ActionContext.getContext().get("request");
		zyService.save(zy1);
		return SUCCESS;
	}
	
	public String zyInfo()throws Exception{
		List list=zyService.findAll();
		Map request=(Map)ActionContext.getContext().get("request");
		request.put("list", list);
		return SUCCESS;
	}
}
